Filter selection prompt items with search#1797
Open
DanBiscotti wants to merge 6 commits intospectreconsole:mainfrom
Open
Filter selection prompt items with search#1797DanBiscotti wants to merge 6 commits intospectreconsole:mainfrom
DanBiscotti wants to merge 6 commits intospectreconsole:mainfrom
Conversation
Author
|
I realize it's not perfect yet, but would be good to hear what you think of the idea, I haven't made a PR in the repo before so apologies if I've missed something! |
Author
|
@microsoft-github-policy-service agree |
|
Just wondering if there's any update on this? I'm currently working on a project that requires search functionality with spaces, so it would be great to have this merged. @DanBiscotti Appreciate your time and efforts on the project! |
missed return true statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #1546
Changes
I changed the code so that now when a user searches, the list is filtered down to only those items which match the search term
ListPromptState.csThere are now 3 lists which hold the current state of the prompt:
ItemsThis existed before and contains all the itemsVisibleItemsThis list contains only items which match the search term, or any groups which contain a child which matches the search term_selectableItemsThis list contains only the subset ofVisibleItemswhich are selectable (ie. not a group if in leaf mode, following the same logic as before with_leafIndexes). it is a list ofSelectableItemwhich contains theListPromptItemand also the index of the item inVisibleItems.VisibleItemsand_selectableItemsare updated every time the search term changes, when the user is navigates the list the only the index of the item in_selectableItemsis updated (which is stored in_selectableIndex).ListPrompt.csVisibleItemsfilterOnSearchSelectionPrompt.csFilterOnSearchpropertystate.Current == null. This happens when theVisibleItemsis filtered to the point it contains no itemsSelectionPromptExtensions.csEnableSearchmethod to setFilterOnSearchMultiSelectionPrompt.csfilterOnSearchIListPromptStrategyPlease upvote 👍 this pull request if you are interested in it.